﻿Imports Tom0014
Imports Tom0014TableAdapters
Partial Class pruebas_GridView_KeyName
    Inherits System.Web.UI.Page
    Dim AnimalTable As New animalDataTable
    Dim AnimalAdap As New animalTableAdapter


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AnimalTable = AnimalAdap.GetAnimalByClave("123%")
        gvAnimales.DataSource = AnimalTable
        gvAnimales.DataBind()


    End Sub

    Protected Sub gvAnimales_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvAnimales.SelectedIndexChanged
        Dim IDAnimal As Integer

        IDAnimal = gvAnimales.SelectedIndex

        IDAnimal = gvAnimales.DataKeys(IDAnimal).Item("AnimalId")

        lblResultado1.Text = IDAnimal.ToString
        lblResultado2.Text = "Nombre: " & gvAnimales.DataKeys(gvAnimales.SelectedIndex).Item("hierro").ToString

    End Sub
End Class
